set (HOMEKIT_ADK "${CMAKE_CURRENT_LIST_DIR}/../homekit_adk")

set (include_dirs "include"
        "${HOMEKIT_ADK}/HAP"
        "${HOMEKIT_ADK}/PAL"
        "${HOMEKIT_ADK}/External/Base64"
        "${HOMEKIT_ADK}/External/JSON"
        "${HOMEKIT_ADK}/External/HTTP"
        )

set (srcs "src/HAPPlatform.c"
		"src/HAPPlatformAbort.c"
		"src/HAPPlatformAccessorySetup.c"
		"src/HAPPlatformAccessorySetupDisplay.c"
		"src/HAPPlatformAccessorySetupNFC.c"
		"src/HAPPlatformBLEPeripheralManager.c"
		"src/HAPPlatformClock.c"
		"src/HAPPlatformKeyValueStore.c"
		"src/HAPPlatformLog.c"
		"src/HAPPlatformMFiHWAuth.c"
		"src/HAPPlatformMFiTokenAuth.c"
		"src/HAPPlatformRandomNumber.c"
		"src/HAPPlatformRunLoop.c"
		"src/HAPPlatformServiceDiscovery.c"
		"src/HAPPlatformTCPStreamManager.c"
		"${HOMEKIT_ADK}/PAL/HAPAssert.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+Crypto.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+Double.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+Float.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+Int.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+MACAddress.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+RawBuffer.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+Sha1Checksum.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+String.c"
		"${HOMEKIT_ADK}/PAL/HAPBase+UTF8.c"
		"${HOMEKIT_ADK}/PAL/HAPLog.c"
		"${HOMEKIT_ADK}/PAL/HAPPlatformSystemInit.c"
        "${HOMEKIT_ADK}/PAL/Crypto/MbedTLS/HAPMbedTLS.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessory+Info.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessoryServer+Reset.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessoryServer.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessorySetup.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessorySetupInfo.c"
		"${HOMEKIT_ADK}/HAP/HAPAccessoryValidation.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEAccessoryServer+Advertising.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEAccessoryServer+Broadcast.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEAccessoryServer.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristic+Broadcast.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristic+Configuration.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristic+Signature.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristic.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristicParseAndWriteValue.c"
		"${HOMEKIT_ADK}/HAP/HAPBLECharacteristicReadAndSerializeValue.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEPDU+TLV.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEPDU.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEPeripheralManager.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEProcedure.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEProtocol+Configuration.c"
		"${HOMEKIT_ADK}/HAP/HAPBLEService+Signature.c"
		"${HOMEKIT_ADK}/HAP/HAPBLESession.c"
		"${HOMEKIT_ADK}/HAP/HAPBLETransaction.c"
		"${HOMEKIT_ADK}/HAP/HAPBitSet.c"
		"${HOMEKIT_ADK}/HAP/HAPCharacteristic.c"
		"${HOMEKIT_ADK}/HAP/HAPCharacteristicTypes.c"
		"${HOMEKIT_ADK}/HAP/HAPDeviceID.c"
		"${HOMEKIT_ADK}/HAP/HAPIP+ByteBuffer.c"
		"${HOMEKIT_ADK}/HAP/HAPIPAccessory.c"
		"${HOMEKIT_ADK}/HAP/HAPIPAccessoryProtocol.c"
		"${HOMEKIT_ADK}/HAP/HAPIPAccessoryServer.c"
		"${HOMEKIT_ADK}/HAP/HAPIPCharacteristic.c"
		"${HOMEKIT_ADK}/HAP/HAPIPSecurityProtocol.c"
		"${HOMEKIT_ADK}/HAP/HAPIPServiceDiscovery.c"
		"${HOMEKIT_ADK}/HAP/HAPJSONUtils.c"
		"${HOMEKIT_ADK}/HAP/HAPLegacyImport.c"
		"${HOMEKIT_ADK}/HAP/HAPMACAddress.c"
		"${HOMEKIT_ADK}/HAP/HAPMFiHWAuth.c"
		"${HOMEKIT_ADK}/HAP/HAPMFiTokenAuth.c"
		"${HOMEKIT_ADK}/HAP/HAPPDU.c"
		"${HOMEKIT_ADK}/HAP/HAPPairing.c"
		"${HOMEKIT_ADK}/HAP/HAPPairingBLESessionCache.c"
		"${HOMEKIT_ADK}/HAP/HAPPairingPairSetup.c"
		"${HOMEKIT_ADK}/HAP/HAPPairingPairVerify.c"
		"${HOMEKIT_ADK}/HAP/HAPPairingPairings.c"
		"${HOMEKIT_ADK}/HAP/HAPRequestHandlers+AccessoryInformation.c"
		"${HOMEKIT_ADK}/HAP/HAPRequestHandlers+HAPProtocolInformation.c"
		"${HOMEKIT_ADK}/HAP/HAPRequestHandlers+Pairing.c"
		"${HOMEKIT_ADK}/HAP/HAPRequestHandlers.c"
		"${HOMEKIT_ADK}/HAP/HAPServiceTypes.c"
		"${HOMEKIT_ADK}/HAP/HAPSession.c"
		"${HOMEKIT_ADK}/HAP/HAPStringBuilder.c"
		"${HOMEKIT_ADK}/HAP/HAPTLV.c"
		"${HOMEKIT_ADK}/HAP/HAPTLVMemory.c"
		"${HOMEKIT_ADK}/HAP/HAPTLVReader.c"
		"${HOMEKIT_ADK}/HAP/HAPTLVWriter.c"
		"${HOMEKIT_ADK}/HAP/HAPUUID.c"
		"${HOMEKIT_ADK}/HAP/HAPVersion.c"
        "${HOMEKIT_ADK}/External/JSON/util_json_reader.c"
        "${HOMEKIT_ADK}/External/HTTP/util_http_reader.c"
        "${HOMEKIT_ADK}/External/Base64/util_base64.c"
        )

idf_component_register(SRCS "${srcs}"
                       INCLUDE_DIRS "${include_dirs}"
                       REQUIRES
                       PRIV_REQUIRES nvs_flash mdns
                       )

add_definitions(-DHAP_LOG_LEVEL=${CONFIG_HAP_LOG_LEVEL})
